    function loadList(){
   
   
  var requestUrl =   '/GedeonMvc/country/list'   ;
   
   
   
   var dataAjax = "total="+$('#CboTotalList').val() ;
       dataAjax+= "&orderBy="+$('#TxtOrderBy').val() ; 
       dataAjax+= "&direction="+$('#TxtDirection').val(); 
       dataAjax+= "&module="+$('#TxtModule').val();
       if(countryName.value != ""){
        dataAjax+= "&name="+$("#countryName").val() ;   
       } 
    
              $.ajax({
        type: "POST",
        url: requestUrl,
        data: dataAjax ,
        success: function(response){
        $('#bodyCountry').html(response);
        },
        error: function(e){
        //alert('Error: ' + e);
        }
        });
 
        var direction = $('#TxtDirection').val(direction) ;
        
        if(direction == "desc"){ 
          CountryUp.style.visibility='hidden' ;
          CountryDown.style.visibility='visible' ;
        }else if(direction == "asc" ){
          CountryUp.style.visibility='visible' ;
          CountryDown.style.visibility='hidden'  ;
        }
 
    }

function setData(orderBy , direction){
    if(direction == "desc"){ 
        CountryUp.style.visibility='hidden' ;
        CountryDown.style.visibility='visible' ;
    }else if(direction == "asc" ){
        CountryUp.style.visibility='visible' ;
        CountryDown.style.visibility='hidden'  ;
    }
    $('#TxtOrderBy').val(orderBy);
    $('#TxtDirection').val(direction); 
    loadList();
    
}

function searchByName(e){
     var code = e.keyCode || e.which;
 if(code == 13) { //Enter keycode
   loadList();
   return false ;
 }
    
}
 
function validateForm(){
    var message = "";
    
    if(description.value == ""){
        message = "Ingrese el nombre" ;
    }else if(longCode.value == ""){
        message ="Ingrese el longcode" ;
    }else if(code.value == ""){
        message ="Ingrese el code" ;
    }else{
        form.submit();     
        return false ;
    }
    
      document.getElementById("bodyMessage").innerHTML = message; 
}

function openPopup(){
    alert("olalalal");
    $( "#dialog_confirm").dialog( "open" );
    return false ; 
}

function confirmDelete(record){
    $('#id').val(record); 
}

function submitDelete(){
  // window.location.href = 'delete?id='+$('#id').val();
    document.getElementById("form").action = 'delete?id='+$('#id').val()+"&module="+$('#module').val();
    document.getElementById("form").submit();  
}
